package com.dlinhorst.android_mcom;

import android.os.CountDownTimer;
import android.widget.TextView;

public class GameCountDownTimer extends CountDownTimer
{
	TextView timeRemaining;

	public GameCountDownTimer(TextView textViewTimeRemaining, long millisInFuture, long countDownInterval)
	{
		super(millisInFuture, countDownInterval);
		timeRemaining = textViewTimeRemaining;
		
	}

	@Override
	public void onFinish()
	{
		timeRemaining.setText("Count Down expired!");
	}

	@Override
	public void onTick(long millisUntilFinished)
	{
		int minutes = (int) ((millisUntilFinished/1000) / 60);
		int seconds = (int) ((millisUntilFinished/1000) - (minutes * 60));
		
		timeRemaining.setText("Time Remaining: " + String.format("%02d", minutes) + ":" + String.format("%02d", seconds));
	}
	
}
